import React from 'react';
class Demo extends React.Component {
    constructor(props) {
        super(props);
        this.toDetail = this.toDetail.bind(this);
    }

    toDetail(id) {
        alert(id);
    }

    render() {
        return (
            <div>
                <h4>事件绑定与传参</h4>
                <ul>
                    <li> <button onClick={() => {this.toDetail(1001)}}>电影1</button> </li>
                    <li> <button onClick={() => {this.toDetail(1002)}}>电影2</button> </li>
                    <li> <button onClick={() => {this.toDetail(1003)}}>电影3</button> </li>
                </ul>
            </div>
        )
    }
}
export default Demo;